/*
 * MIT License
 *
 * Copyright (c) 2020 wen.gu <454727014@qq.com>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

/***************************************************************************
 * Name: avp_demux.h
 *
 * Purpose: implementation demux for av player
 *
 * Developer:
 *   wen.gu , 2022-01-19
 *
 * TODO:
 *
 ***************************************************************************/

/******************************************************************************
 **    INCLUDES
 ******************************************************************************/
#ifndef __AVP_DEMUX_H__
#define __AVP_DEMUX_H__

#include <stdio.h>
#include "avp_type.h"
#include "avp_error.h"

#include "avp_media.h"
#include "avp_packet.h"

/******************************************************************************
 **    MACROS
 ******************************************************************************/

/******************************************************************************
 **    TYPE DEFINITIONS
 ******************************************************************************/
G_C_HEADER_START

struct _avp_demux;
typedef struct _avp_demux* avp_demux_t;

/******************************************************************************
 **    CLASSES/FUNCTIONS DEFINITIONS
 ******************************************************************************/
G_API GErrc avp_demux_create(avp_demux_t* demux);
G_API void avp_demux_destroy(avp_demux_t demux);

G_API GErrc avp_demux_set_source(avp_demux_t demux, const GSTR url);

G_API GU32 avp_demux_stream_count(avp_demux_t demux);
G_API GU32 avp_demux_stream_count_ex(avp_demux_t demux, avp_media_category_t category);

G_API GBOL avp_demux_stream_eixst(avp_demux_t demux, avp_media_category_t category);

G_API GErrc avp_demux_stream_get_info(avp_demux_t demux, GU32 stream_index, avp_media_stream_t* stream_info);

G_API GErrc avp_demux_stream_select(avp_demux_t demux, GU32 stream_index, avp_packet_queue_t outque_queue); /***/
G_API GErrc avp_demux_stream_unselect(avp_demux_t demux, GU32 stream_index);
G_API GErrc avp_demux_stream_unselect_all(avp_demux_t demux);

G_API GErrc avp_demux_stream_select_default(avp_demux_t demux, avp_media_category_t category, avp_packet_queue_t outque_queue);

G_API GErrc avp_demux_stream_playing(avp_demux_t demux, avp_media_category_t category, GU32* stream_index);


G_API GErrc avp_demux_start(avp_demux_t demux);
G_API GErrc avp_demux_pause(avp_demux_t demux);




G_C_HEADER_END

#endif /** !__AVP_DEMUX_H__ */

